#ifndef RESOURCEMANAGER_H
#define RESOURCEMANAGER_H

#include <string>
#include <map>

#include "bga/system/Singleton.h"
#include "bga/system/Resource.h"

/*!
 * \namespace bga
 *
 */
namespace bga
{

/*!
 * \class ResourceManager
 * \brief Allow to handle resources without Memory Leak
 *
 *
 */
class BOARD_HELL_ENGINE ResourceManager : public Singleton<ResourceManager>
{
    friend class Singleton< ResourceManager >;

	public:
		ResourceManager();
		virtual ~ResourceManager();

		/**
		 * \brief get a resource
		 * \return a pointer to the resource asked or NULL if it doesn't exist
		 */
        template< typename T >
		T* get(const std::string& name);

		/**
		 * \brief add a resource to the manager
		 * \param name : id of the resource
		 * \param resource : resource to add
		 */
        void add(const std::string& name, Resource* resource);

        ///TODO : Handle removal

	protected:

	private:
        std::map< std::string, Resource* > resources;

};

}

#include "bga/system/ResourceManager.inl"

#endif // RESOURCEMANAGER_H

